using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.Mvc;
using System.Web.Mvc.Ajax;
using Killboard.Models;

namespace Killboard.Controllers
{
    public class TestController : Controller
    {
        //
        // GET: /Test/

        public ActionResult Index()
        {
            return View("KMEnter");
        }

        public ActionResult PositionTest()
        {
            return View();
        }

        [AcceptVerbs(HttpVerbs.Post)]
        public ActionResult Submit(FormCollection fc)
        {
            KillMail km = new KillMail();
            string kmtext = fc["KMText"];
            km.Parse(kmtext);

            int killNumber = km.SaveKill();

            //return View("Index", km);
            return RedirectToAction("KillDisplay2", "Kill", new { id = killNumber });

         
        }

        [ValidateInput(false)]
        [AcceptVerbs(HttpVerbs.Post)]
        public ActionResult SubmitXml(FormCollection fc)
        {
            
            string kmtext = fc["KMXml"];

            KillMailXmlParser km = new KillMailXmlParser();
            
            KMParseResults res = km.ParseXML(kmtext);



            return View("parseresults", res);

        }

        public ActionResult XMLTest()
        {
            return View("XMLTest");
        }

    }
}
